package net.wsfcp.android.http.mvp.presenter;

import net.wsfcp.android.base.BasePresenter;
import net.wsfcp.android.bean.resultbean.TabBean;
import net.wsfcp.android.http.mvp.contract.MainContract;
import net.wsfcp.android.http.mvp.model.MainModel;
import net.wsfcp.android.http.mvp.IModel;
import net.wsfcp.android.ui.view.main.activity.MainActivity;

import java.util.ArrayList;
import java.util.HashMap;

//获取首页底部banner
public class MainPresenter extends BasePresenter<MainActivity> implements
        MainContract.MainPresenter {


    @Override
    public void getTab() {
        ((MainModel) getiModelMap().get("tab")).getTab(new MainModel.MainInfoHint() {
            @Override
            public void getTabSuccess(ArrayList<TabBean> tabBean) {
                getIView().getTabSuccess(tabBean);  //成功
            }

            @Override
            public void getTabFail(String str) {
                getIView().getTabFail(str);  //成功
            }


        });
    }


    @Override
    public HashMap<String, IModel> getiModelMap() {
        return loadModelMap(new MainModel());
    }

    @Override
    public HashMap<String, IModel> loadModelMap(IModel... models) {
        HashMap<String, IModel> map = new HashMap<>();
        map.put("tab", models[0]);
        return map;
    }



}
